#include "syscall.h"

char output[16];
int lockNum;
void simpleTest()
{
	Write("I forked\n",9, ConsoleOutput );
	Exit(0);
}

void acquire()
{
	Write("A thread started\n",17,ConsoleOutput);
	Acquire(lockNum);
	Write("I got a lock\n",13, ConsoleOutput );
	Yield();
	Yield();
	Yield();
	Yield();
	Yield();
	Release(lockNum);
	Write("I released a lock\n",18, ConsoleOutput);
	Exit(0);
}

int main()
{
	int i=0;
	Write("ForkTest started\n",17,ConsoleOutput);
	Fork(simpleTest);
	lockNum=CreateLock("My lock",7);
	Fork(acquire);
	Fork(acquire);
	Write("Finished\n",9,ConsoleOutput);
	Exit(0);
}
